package com.industrial.premu.controller;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;

import com.industrial.common.core.utils.StringUtils;
import com.industrial.common.security.utils.SecurityUtils;
import com.industrial.premu.domain.*;
import com.industrial.premu.domain.sqsj.PreMuImportAdd;
import com.industrial.premu.domain.sqsj.PreMuImportAddSubstract;
import com.industrial.premu.domain.sqsj.PreMuImportCustomIndexLj;
import com.industrial.premu.domain.sqsj.PreMuImportVeto;
import com.industrial.premu.mapper.PreMuIndexWeightMainMapper;
import com.industrial.premu.mapper.sqsj.PreMuImportAddMapper;
import com.industrial.premu.mapper.sqsj.PreMuImportCustomIndexLjMapper;
import com.industrial.premu.mapper.sqsj.PreMuImportSubstractMapper;
import com.industrial.premu.mapper.sqsj.PreMuImportVetoMapper;
import com.industrial.premu.service.IPreMuBenefitEvaluationAppealService;
import com.industrial.premu.service.IPreMuBenefitEvaluationService;
import com.industrial.premu.service.IPreMuCompanyInfoService;
import com.industrial.premu.vo.PreMuBenefitEvaluationVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.industrial.common.log.annotation.Log;
import com.industrial.common.log.enums.BusinessType;
import com.industrial.common.security.annotation.RequiresPermissions;
import com.industrial.premu.service.IPreMuBenefitEvaluationAppealDetailsService;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.utils.poi.ExcelUtil;
import com.industrial.common.core.web.page.TableDataInfo;

/**
 * 企业数据申诉-详情Controller
 * 
 * @author zhous
 * @date 2024-01-26
 */
@RestController
@RequestMapping("/details")
public class PreMuBenefitEvaluationAppealDetailsController extends BaseController
{
    @Autowired
    private IPreMuBenefitEvaluationAppealDetailsService preMuBenefitEvaluationAppealDetailsService;
    @Autowired
    private IPreMuBenefitEvaluationAppealService preMuBenefitEvaluationAppealService;
    @Autowired
    private PreMuImportAddMapper preMuImportAddMapper;
    @Autowired
    private IPreMuBenefitEvaluationService preMuBenefitEvaluationService;
    @Autowired
    PreMuImportVetoMapper preMuImportVetoMapper;

    @Autowired
    private PreMuImportSubstractMapper preMuImportSubstractMapper;

    @Autowired
    private PreMuImportCustomIndexLjMapper preMuImportCustomIndexLjMapper;

    @Autowired
    private PreMuIndexWeightMainMapper preMuIndexWeightMainMapper;
    /**
     * 查询企业数据申诉-详情列表
     */
    @RequiresPermissions("premu:details:list")
    @GetMapping("/list")
    public TableDataInfo list(PreMuBenefitEvaluationAppealDetails preMuBenefitEvaluationAppealDetails)
    {
        preMuBenefitEvaluationAppealDetails.setDelFlag("0");

        startPage();
        List<PreMuBenefitEvaluationAppealDetails> list = preMuBenefitEvaluationAppealDetailsService.selectPreMuBenefitEvaluationAppealDetailsList(preMuBenefitEvaluationAppealDetails);
        return getDataTable(list);
    }

    /**
     * 导出企业数据申诉-详情列表
     */
    @RequiresPermissions("premu:details:export")
    @Log(title = "企业数据申诉-详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PreMuBenefitEvaluationAppealDetails preMuBenefitEvaluationAppealDetails)
    {
        List<PreMuBenefitEvaluationAppealDetails> list = preMuBenefitEvaluationAppealDetailsService.selectPreMuBenefitEvaluationAppealDetailsList(preMuBenefitEvaluationAppealDetails);
        ExcelUtil<PreMuBenefitEvaluationAppealDetails> util = new ExcelUtil<PreMuBenefitEvaluationAppealDetails>(PreMuBenefitEvaluationAppealDetails.class);
        util.exportExcel(response, list, "企业数据申诉-详情数据");
    }

    /**
     * 获取企业数据申诉-详情详细信息
     */
    @RequiresPermissions("premu:details:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(preMuBenefitEvaluationAppealDetailsService.selectPreMuBenefitEvaluationAppealDetailsById(id));
    }

    /**
     * 新增企业数据申诉-详情
     */
    @RequiresPermissions("premu:details:add")
    @Log(title = "企业数据申诉-详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PreMuBenefitEvaluationAppealDetails preMuBenefitEvaluationAppealDetails)
    {
        return toAjax(preMuBenefitEvaluationAppealDetailsService.insertPreMuBenefitEvaluationAppealDetails(preMuBenefitEvaluationAppealDetails));
    }
    private static String convertToUnderscore(String input) {
        StringBuilder result = new StringBuilder();
        for (int i = 0; i < input.length(); i++) {
            char currentChar = input.charAt(i);

            // 如果是大写字母，则在其前面添加下划线，并将大写字母转换为小写
            if (Character.isUpperCase(currentChar)) {
                result.append("_").append(Character.toLowerCase(currentChar));
            } else {
                result.append(currentChar);
            }
        }
        return result.toString();
    }
    @Autowired
    private IPreMuCompanyInfoService preMuCompanyInfoService;
    /**
     * 修改企业数据申诉-详情
     */
    @RequiresPermissions("premu:details:edit")
    @Log(title = "企业数据申诉-详情", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PreMuBenefitEvaluationAppealDetails preMuBenefitEvaluationAppealDetails)
    {

        String userName= SecurityUtils.getLoginUser().getUsername();
        preMuBenefitEvaluationAppealDetails.setHandleUser(userName);
        preMuBenefitEvaluationAppealDetails.setHandleTime(new Date());
        if(preMuBenefitEvaluationAppealDetails.getStatus().contains("1")){
            PreMuBenefitEvaluationAppeal preMuBenefitEvaluationAppeal=
                    preMuBenefitEvaluationAppealService.selectPreMuBenefitEvaluationAppealById(preMuBenefitEvaluationAppealDetails.getAppealId());
           if(StringUtils.isNotNull(preMuBenefitEvaluationAppealDetails.getAppealType())){
               if(preMuBenefitEvaluationAppealDetails.getAppealType().contains("1")){
                   //修改加分得分
                   PreMuImportAdd preMuImportAdd =new PreMuImportAdd();
                   PreMuCompanyInfo padd=  preMuCompanyInfoService.getById(preMuBenefitEvaluationAppeal.getCompanyId());
                   preMuImportAdd.setUscc(padd.getUscc());
                   preMuImportAdd.setItemNames(preMuBenefitEvaluationAppealDetails.getField());
                   preMuImportAdd.setItemScore(preMuBenefitEvaluationAppealDetails.getShouldValue());
                   preMuImportAdd.setYear(preMuBenefitEvaluationAppealDetails.getYears());
                   preMuImportAddMapper.updateByUsccAndIemNames(preMuImportAdd);
               }else if(preMuBenefitEvaluationAppealDetails.getAppealType().contains("2")){
                   //修改减分得分
                   PreMuImportAddSubstract preMuImportSubstract=new PreMuImportAddSubstract();
                   PreMuCompanyInfo pdel=  preMuCompanyInfoService.getById(preMuBenefitEvaluationAppeal.getCompanyId());
                   preMuImportSubstract.setUscc(pdel.getUscc());
                   preMuImportSubstract.setItemNames(preMuBenefitEvaluationAppealDetails.getField());
                   preMuImportSubstract.setItemScore(new BigDecimal(preMuBenefitEvaluationAppealDetails.getShouldValue()));
                   preMuImportSubstract.setYear(preMuBenefitEvaluationAppealDetails.getYears());
                   preMuImportSubstractMapper.updateByUsccAndIemNames(preMuImportSubstract);
               }else if(preMuBenefitEvaluationAppealDetails.getAppealType().contains("3")){
                   //修改否决项
                   PreMuImportVeto preMuImportVeto=new PreMuImportVeto();
                   PreMuCompanyInfo pveto=  preMuCompanyInfoService.getById(preMuBenefitEvaluationAppeal.getCompanyId());
                   preMuImportVeto.setUscc(pveto.getUscc());
                   preMuImportVeto.setVetoApply(preMuBenefitEvaluationAppealDetails.getShouldValue());
                   preMuImportVeto.setVetoName(preMuBenefitEvaluationAppealDetails.getField());
                   preMuImportVeto.setYear(preMuBenefitEvaluationAppealDetails.getYears());
                   preMuImportVetoMapper.updatePreMuImportVetoByUscc(preMuImportVeto);
               }else if(preMuBenefitEvaluationAppealDetails.getAppealType().contains("4")){
                   //修改自定义
                   PreMuImportCustomIndexLj preMuImportCustomIndexLj=new PreMuImportCustomIndexLj();

                   PreMuBenefitEvaluationAppeal pl=
                           preMuBenefitEvaluationAppealService.selectPreMuBenefitEvaluationAppealById(preMuBenefitEvaluationAppealDetails.getAppealId()) ;
                   PreMuBenefitEvaluationVo p= preMuBenefitEvaluationService.getById(pl.getBenefitEvaluationId());
                   preMuImportCustomIndexLj.setEnterId(p.getCompanyId());
                   preMuImportCustomIndexLj.setIndexName(preMuBenefitEvaluationAppealDetails.getField());
                   preMuImportCustomIndexLj.setYear(preMuBenefitEvaluationAppealDetails.getYears());
                   preMuImportCustomIndexLj.setIndexValue(preMuBenefitEvaluationAppealDetails.getShouldValue());
                   preMuImportCustomIndexLjMapper.updateIndexLj(preMuImportCustomIndexLj);
               }
           }else{
                //修改亩产效益表中数据
               if(StringUtils.isNotNull(preMuBenefitEvaluationAppealDetails.getFieldName())){
                   if("landTax".contains(preMuBenefitEvaluationAppealDetails.getFieldName())){

                   }else{
                       String fielName=convertToUnderscore(preMuBenefitEvaluationAppealDetails.getFieldName());
                       preMuBenefitEvaluationAppealDetails.setFieldName(fielName);
                   }
               }
            PreMuBenefitEvaluationAppeal p=     preMuBenefitEvaluationAppealService.selectPreMuBenefitEvaluationAppealById(preMuBenefitEvaluationAppealDetails.getAppealId()) ;
               preMuBenefitEvaluationAppealDetails.setBenefitEvaluationId(p.getBenefitEvaluationId());
               int flag= preMuBenefitEvaluationAppealDetailsService.updateByFieldName(preMuBenefitEvaluationAppealDetails);

               PreMuBenefitEvaluation preMuBenefitEvaluation=preMuBenefitEvaluationService.selectPreMuBenefitEvaluationById(preMuBenefitEvaluationAppealDetails.getBenefitEvaluationId());
               //重新计算分数
                if(flag==1){
                    BigDecimal sssjgx = preMuBenefitEvaluation.getActualTax() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getActualTax();
                    BigDecimal ydmj = preMuBenefitEvaluation.getSumArea() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getSumArea();
                    if(!(ydmj.compareTo(new BigDecimal(0)) <= 0)){
                        preMuBenefitEvaluation.setScore1(sssjgx.divide(ydmj,2,BigDecimal.ROUND_HALF_UP));
                    }else{
                        throw new RuntimeException(String.format("%s用地面积数据不全,请检查!",preMuBenefitEvaluation.getCompanyName()));
                    }
                    BigDecimal xssr = preMuBenefitEvaluation.getMainIncome()  == null ? new BigDecimal("0") : preMuBenefitEvaluation.getMainIncome();
                    //计算单位用地销售收入得分
                    BigDecimal zydmj = preMuBenefitEvaluation.getSumArea() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getSumArea();
                    if(!(zydmj.compareTo(new BigDecimal(0)) == 0)){
                        preMuBenefitEvaluation.setScore7(xssr.divide(zydmj,2,BigDecimal.ROUND_HALF_UP));
                    }
                    //计算收入利润率(利润总额 ÷ 销售收入)
                    BigDecimal profitTotalBigDecimal = preMuBenefitEvaluation.getProfitTotal() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getProfitTotal();
//                    PreMuCompanyInfo companyInfo=  preMuCompanyInfoService.getById(preMuBenefitEvaluationAppeal.getCompanyId());
//                    String companyType = companyInfo.getCompanyType();
//                    String evaluateByIndustry = companyInfo.getEvaluateByIndustry();
//                    String zone = companyInfo.getZone();
//                    String industryType = companyInfo.getIndustryType();
//                    if(StringUtils.isEmpty(evaluateByIndustry)||"否".equals(evaluateByIndustry.trim())){
//                        industryType = "-1";
//                    }
//                    //查询指标管理中的权重和基准值
//                    PreMuIndexWeightMain preMuIndexWeightMainQueryParams = new PreMuIndexWeightMain();
//                    preMuIndexWeightMainQueryParams.setYear(preMuBenefitEvaluation.getYears());
//                    preMuIndexWeightMainQueryParams.setCompanyType(companyType);
//                    preMuIndexWeightMainQueryParams.setCounty(preMuBenefitEvaluation.getCounty());
//                    preMuIndexWeightMainQueryParams.setPark(zone);
//                    preMuIndexWeightMainQueryParams.setIndustry(industryType);
//                    PreMuIndexWeightMain preMuIndexWeightMain = preMuIndexWeightMainMapper.selectOne(preMuIndexWeightMainQueryParams);
//                    Map<String, PreMuIndexWeightSub> preMuIndexWeightMap = new HashMap<>(16);
//                    if (preMuIndexWeightMain != null && preMuIndexWeightMain.getPreMuIndexWeightSubList() != null && !preMuIndexWeightMain.getPreMuIndexWeightSubList().isEmpty()) {
//                        List<PreMuIndexWeightSub> preMuIndexWeightSubList = preMuIndexWeightMain.getPreMuIndexWeightSubList();
//                        preMuIndexWeightMap = preMuIndexWeightSubList.stream().collect(Collectors.toMap(PreMuIndexWeightSub::getIndexName, v -> v));
//                    }
//                    BigDecimal profitTotalBigDecimal = preMuBenefitEvaluation.getProfitTotal() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getProfitTotal();
//                    BigDecimal profitScore = profitTotalBigDecimal.divide(xssr,6,BigDecimal.ROUND_HALF_UP);
//                    PreMuIndexWeightSub profitWeight = preMuIndexWeightMap.get("收入利润率");
//
//                    //获取权重
//                    if (profitWeight != null && profitScore != null) {
//                        BigDecimal profitWeightBigDecimal = profitWeight.getIndexValue() == null ? new BigDecimal(0) : new BigDecimal(profitWeight.getIndexValue());
//                        BigDecimal profitBaseline = StringUtils.isBlank(profitWeight.getIndexValueLine()) ? new BigDecimal(0) : new BigDecimal(profitWeight.getIndexValueLine());
//                        BigDecimal subtractRange = profitScore.subtract(profitBaseline).abs();
//                        BigDecimal resultScore = new BigDecimal("0");
//                        if(profitScore.compareTo(profitBaseline) == -1){
//                            BigDecimal fivePercent = new BigDecimal("5");
//                            BigDecimal tenPercent = new BigDecimal("10");
//                            BigDecimal twentyPercent = new BigDecimal("20");
//
//                            if (subtractRange.compareTo(fivePercent) <= 0) {
//                                // 低于 5%  分值*80%
//                                resultScore = profitWeightBigDecimal.multiply(new BigDecimal("0.8"));
//                            } else if (subtractRange.compareTo(tenPercent) <= 0) {
//                                // 5% - 10%  分值*60%
//                                resultScore = profitWeightBigDecimal.multiply(new BigDecimal("0.6"));
//                            } else if (subtractRange.compareTo(twentyPercent) <= 0) {
//                                // 10% - 20% 分值*40%
//                                resultScore = profitWeightBigDecimal.multiply(new BigDecimal("0.4"));
//                            } else {
//                                // 大于等于 20%  0分
//                                resultScore = BigDecimal.ZERO;
//                            }
//                        }else{
//                            resultScore = profitWeightBigDecimal;
//                        }
//                        preMuBenefitEvaluation.setScore8(resultScore.setScale(2,BigDecimal.ROUND_HALF_UP));
//
//                    }

//                    if(profitTotalBigDecimal.compareTo(BigDecimal.ZERO) == 0){
//                        throw new RuntimeException(String.format("%利润总额为空或为0,请检查!",preMuBenefitEvaluation.getCompanyName()));
//                    }
                    if(!(profitTotalBigDecimal.compareTo(new BigDecimal(0)) == 0)){
                        preMuBenefitEvaluation.setScore8(profitTotalBigDecimal.divide(xssr,4,BigDecimal.ROUND_HALF_UP));
                    }else{
                        preMuBenefitEvaluation.setScore8(BigDecimal.ZERO);
                    }
                    if(preMuBenefitEvaluation.getCompanyType().contains("1")){


                        //计算单位能耗销售收入得分 - 公式：销售收入 / 总能耗
                        //总能耗
                        BigDecimal totalUsedBigDecimal = preMuBenefitEvaluation.getTotalUsed() == null ? new BigDecimal("0") : new BigDecimal(preMuBenefitEvaluation.getTotalUsed());
                        if(totalUsedBigDecimal.compareTo(BigDecimal.ZERO) <= 0){
                            throw new RuntimeException(String.format("%s总能耗为空或为0,请检查!",preMuBenefitEvaluation.getCompanyName()));
                        }
                        if(!(totalUsedBigDecimal.compareTo(new BigDecimal(0)) == 0)){
                            preMuBenefitEvaluation.setScore2(xssr.divide(totalUsedBigDecimal,2,BigDecimal.ROUND_HALF_UP));
                        }
                        //计算单位污染物排放销售收入得分 - 公式：销售收入 / 主要污染排放总当量

                        BigDecimal wrwpfdl = preMuBenefitEvaluation.getTotalEquivalent() == null ? new BigDecimal("0") : new BigDecimal(preMuBenefitEvaluation.getTotalEquivalent());
                        if(!(wrwpfdl.compareTo(new BigDecimal(0)) <= 0)){
                            preMuBenefitEvaluation.setScore3(xssr.divide(wrwpfdl,2,BigDecimal.ROUND_HALF_UP));
                        }else{
                            preMuBenefitEvaluation.setScore3(new BigDecimal("0.0000"));
                        }
                        //计算研发经费投入强度得分 - 公式：研发经费投入强度 = 研发经费支出 / 销售收入

                        BigDecimal yfjfzc = preMuBenefitEvaluation.getRdFunds() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getRdFunds();
                        BigDecimal score4 = new BigDecimal("0.00");
                        if(xssr != null && xssr.compareTo(BigDecimal.ZERO) > 0){
                            score4 = yfjfzc.divide(xssr, 4, BigDecimal.ROUND_HALF_UP);
                        }
                        BigDecimal bigDecimal = new BigDecimal("100.0000");
                        score4 = score4.multiply(bigDecimal).setScale(4, BigDecimal.ROUND_HALF_UP);
                        preMuBenefitEvaluation.setScore4(score4);

                        Long annualEmployees = preMuBenefitEvaluation.getAnnualEmployees();
                        if(annualEmployees == null || annualEmployees == 0L){
                            throw new RuntimeException(String.format("%s 年平均职工人数为空，请检查！",preMuBenefitEvaluation.getCompanyName()));
                        }
                        BigDecimal gyzcz = preMuBenefitEvaluation.getIndustryOutput() == null ? new BigDecimal("0") : preMuBenefitEvaluation.getIndustryOutput();
                        BigDecimal score5 = gyzcz.divide(BigDecimal.valueOf(annualEmployees), 2, BigDecimal.ROUND_HALF_UP);
                        preMuBenefitEvaluation.setScore5(score5);
                        //指标：单位水耗销售收入 单位：立方米/万元  计算方式：销售收入（万元）/耗水量
                        BigDecimal waterBureau = preMuBenefitEvaluation.getWaterBureau();
                        if (waterBureau != null && waterBureau.compareTo(BigDecimal.ZERO) != 0) {
                            BigDecimal score6 = xssr.divide(waterBureau, 2, BigDecimal.ROUND_HALF_UP);
                            score6 = score6.setScale(2, BigDecimal.ROUND_HALF_UP);
                            preMuBenefitEvaluation.setScore6(score6);
                        } else {
                            preMuBenefitEvaluation.setScore6(new BigDecimal("0.0000"));
                        }
                    }else if("2".contains(preMuBenefitEvaluation.getCompanyType())){
                        BigDecimal scoreNull = new BigDecimal("0.0000");
                        preMuBenefitEvaluation.setScore2(scoreNull);
                        preMuBenefitEvaluation.setScore3(scoreNull);
                        preMuBenefitEvaluation.setScore4(scoreNull);
                        preMuBenefitEvaluation.setScore5(scoreNull);
                        preMuBenefitEvaluation.setScore6(scoreNull);
                    }
                    preMuBenefitEvaluationService.updateSores(preMuBenefitEvaluation);
                }
           }
        }

        preMuBenefitEvaluationAppealDetailsService.updatePreMuBenefitEvaluationAppealDetails(preMuBenefitEvaluationAppealDetails);

        if(StringUtils.isNotNull(preMuBenefitEvaluationAppealDetails.getAppealId())){
            PreMuBenefitEvaluationAppeal appeal=
                    preMuBenefitEvaluationAppealService.selectPreMuBenefitEvaluationAppealById(preMuBenefitEvaluationAppealDetails.getAppealId());
            if(appeal!=null){
                PreMuBenefitEvaluationAppealDetails  details=new PreMuBenefitEvaluationAppealDetails();
                details.setAppealId(appeal.getId());
                List<PreMuBenefitEvaluationAppealDetails> list =
                        preMuBenefitEvaluationAppealDetailsService.selectPreMuBenefitEvaluationAppealDetailsList(details);
                if(list!=null&&list.size()>0){
                    List<PreMuBenefitEvaluationAppealDetails> collect = list.stream().filter(a -> (a.getStatus().equals("0"))).collect(Collectors.toList());
                    if(collect.size()==0){
                        appeal.setStatus("1");

                    }
                }
                appeal.setHandleTime(new Date());
                preMuBenefitEvaluationAppealService.updatePreMuBenefitEvaluationAppeal(appeal);
            }
            return  AjaxResult.success("成功");
        }else{
            return  AjaxResult.error("失败");
        }

    }

    /**
     * 删除企业数据申诉-详情
     */
    @RequiresPermissions("premu:details:remove")
    @Log(title = "企业数据申诉-详情", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(preMuBenefitEvaluationAppealDetailsService.deletePreMuBenefitEvaluationAppealDetailsByIds(ids));
    }


    @PutMapping("/editsDetails")
    public AjaxResult editsDetails(@RequestBody PreMuBenefitEvaluationAppealDetails [] preMuBenefitEvaluationAppealDetailss)
    {
        int flag=0;
        for (int i = 0; i <preMuBenefitEvaluationAppealDetailss.length ; i++) {
            preMuBenefitEvaluationAppealDetailss[i].setStatus("0");

            flag+= preMuBenefitEvaluationAppealDetailsService.updatePreMuBenefitEvaluationAppealDetails(preMuBenefitEvaluationAppealDetailss[i]);
        }
        return toAjax(flag);
    }

    @PutMapping("/editById")
    public AjaxResult editById(@RequestBody PreMuBenefitEvaluationAppealDetails  preMuBenefitEvaluationAppealDetails)
    {

        return toAjax(preMuBenefitEvaluationAppealDetailsService.updatebyId(preMuBenefitEvaluationAppealDetails));
    }

}
